<html>
   <head>
      <title>Historical data histogram</title>
   </head>
   <body>
      <table>
         <tr>
            <g:form>
            <td>
            		<g:select name="select1" from="${['DIA', 'SPY', 'GLD']}" value="${params.select1}"/>
            </td> 
            <td>
               <g:select name="fieldVar" from="${['Open', 'High', 'Low', 'Close', 'Volume']}" value="${params.fieldVar}"/>
            </td>
            <td>
               <g:actionSubmit name="doChart" action="index" value="Chart"/>
            </td>
            </g:form></td>
         </tr>
      </table>
      
      <g:if test="${data != null}">
	        <g:barChart type="bvs"
	       		title="Histogram ${params.select1} (${params.fieldVar})"
				size="${[900,200]}" 
				colors="${['00FF00']}" 
				fill="${'bg,s,efefef' }"
				axes="x,y"
				axesLabels="${
					[0:data.keySet(),
					1:[0,data.values().max()/2, data.values().max()]
					]
					 }"
				dataType="simple"
				data="${data.values().asList()}"
				/>
		</g:if>
		
		<br/> <br/>
		
		<g:if test="${deltaData != null}">
	        <g:barChart type="bvs"
	       		title="Histogram ${params.select1} (${params.fieldVar} - previous day ${params.fieldVar}) "
				size="${[900,200]}" 
				colors="${['00FF00']}" 
				fill="${'bg,s,efefef' }"
				axes="x,y"
				axesLabels="${
					[0:deltaData.keySet(),
					1:[0,deltaData.values().max()/2, deltaData.values().max()]
					]
					 }"
				dataType="simple"
				data="${deltaData.values().asList()}"
				/>
		</g:if>
		
		<br/> <br/>
		
		<g:if test="${lnData != null}">
	        <g:barChart type="bvs"
	       		title="Histogram ${params.select1} (Log ${params.fieldVar}) "
				size="${[900,200]}" 
				colors="${['00FF00']}" 
				fill="${'bg,s,efefef' }"
				axes="x,y"
				axesLabels="${
					[0:lnData.keySet(),
					1:[0,lnData.values().max()/2, lnData.values().max()]
					]
					 }"
				dataType="simple"
				data="${lnData.values().asList()}"
				/>
		</g:if>
		
		<br/><br/>
		
		<g:if test="${deltaLnData != null}">
	        <g:barChart type="bvs"
	       		title="Histogram ${params.select1} (Log ${params.fieldVar} - Log previous day ${params.fieldVar}) "
				size="${[900,200]}" 
				colors="${['00FF00']}" 
				fill="${'bg,s,efefef' }"
				axes="x,y"
				axesLabels="${
					[0:deltaLnData.keySet(),
					1:[0,deltaLnData.values().max()/2, deltaLnData.values().max()]
					]
					 }"
				dataType="simple"
				data="${deltaLnData.values().asList()}"
				/>
		</g:if>
    </body>
</html>